/**
 * @author 李泽江
 */
public class Main {
    public static void main(String[] args) {
        ThreadTest tt = new ThreadTest();
        tt.setName("子线程");
        tt.start();
        System.out.println(tt.getPriority());

        //给主线程命名
        Thread.currentThread().setName("主线程");

        for (int i = 0; i <100; i++){
            System.out.println(Thread.currentThread().getName()+":"+i);
            System.out.println(tt.isAlive());
            if (i==20){
                try {
                    tt.join();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }
        System.out.println(tt.isAlive());
    }
}